package magicboard.classifier
{

	import magicboard.model.GeometryObject;
	import magicboard.model.LineSegment;
	import magicboard.model.Model;
	import magicboard.model.Polyline;
	import magicboard.model.algorithms.DPPolylineSimplification;
	
	public class Classifier
	{
		public function Classifier()
		{
		}
		
		// --------------------------------------------------------------------------------------------
		public function classify(input:Polyline, layout:Model):GeometryObject
		{	
			var obj:GeometryObject;
			var dp:DPPolylineSimplification = new DPPolylineSimplification();
			var vertices:Array;
			
			vertices = dp.simplify(input.points);
			if(vertices.length == 2){
				obj = new LineSegment(vertices[0], vertices[1]); 
			}
			else{
				obj = input;//new Polyline(vertices);
			}

		  return obj;
		}

	}
}